package com.sharyuke.viam.ui.base

import android.os.Bundle
import android.view.LayoutInflater
import androidx.lifecycle.lifecycleScope
import androidx.viewbinding.ViewBinding
import kotlinx.coroutines.launch

open class BaseViewActivity<B : ViewBinding>(bindBlock: (LayoutInflater) -> B) : BaseActivity() {
    protected val binding: B by lazy { bindBlock(layoutInflater) }
    protected fun hasView(block: suspend B.() -> Unit) = lifecycleScope.launch { block(binding) }
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
    }
}